<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="container"></div>

  <script>
    // 演示大量 DOM 加载时的缓慢问题，也就是“长列表问题”
    const container = document.getElementById("container");

    console.time('长列表')
    for (let i = 0; i < 100000; i++) {
      const div = document.createElement("div")
      div.innerText = i
      container.appendChild(div)
    }
    setTimeout(() => {
      console.timeEnd('长列表')
    }, 0);
  </script>
</body>

</html>